#include <stdio.h>
#include <unistd.h>

int main()
{
    int cnt = 0;
    while (1)
    {
        if(cnt==10) break;
        int ret = fork();
        if (ret < 0)
        {
            printf("fork error!,cnt: %d\n", cnt);
            break;
        }
        else if (ret == 0)
        {
            // child process
            while (1)
            {
                /* code */
                sleep(1);
            }
        }
        // parent process
        cnt++;
    }
    return 0;
}